<template>
    <div class="home-page">
      <header>
        <img src="@/assets/logo.png" alt="FlowDeer Tree" />
        <h1>FlowDeer Tree</h1>
        <p>用于深度思考和复杂流程的AI思维树</p>
      </header>
      <div class="grid">
        <div
          v-for="item in items"
          :key="item.id"
          class="grid-item"
          @click="navigateToSubPage(item)"
        >
          <h3>{{ item.name }}</h3>
          <button>开始</button>
        </div>
      </div>
    </div>
  </template>
  
  <script>
  import data from '@/data.json';
  
  export default {
    name: 'HomePage',
    data() {
      return {
        items: data.items,
      };
    },
    methods: {
      navigateToSubPage(item) {
        this.$router.push({ name: 'SubPage', params: { id: item.id } });
      },
    },
  };
  </script>
  
  <style scoped>
  .home-page {
    text-align: center;
    padding: 20px;
  }
  
  header {
    margin-bottom: 40px;
  }
  
  header img {
    width: 200px;
    height: auto;
  }
  
  .grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
  }
  
  .grid-item {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  }
  
  .grid-item h3 {
    margin: 0 0 10px 0;
  }
  
  .grid-item button {
    background: #007bff;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
  }
  </style>